var b_lang;//=1，点击状态按钮
var SortJson=[];//排序用的数组
var app_url=location.origin;
var EDITMODE=false; 
//日期格式化
var calendarDateFormat = myApp.calendar({
	input: '#eupdatetime',
    monthNames: ['01'+_('月'), '02'+_('月'), '03'+_('月'), '04'+_('月'), '05'+_('月'), '06'+_('月'), '07'+_('月'), '08'+_('月') , '09'+_('月') , '10'+_('月'), '11'+_('月'), '12'+_('月')],
    dayNamesShort: [_('日'), _('一'), _('二'), _('三'), _('四'), _('五'), _('六')],
    closeOnSelect:true,
});
var calendarDateFormat = myApp.calendar({
	input: '#supdatetime',
    monthNames: ['01'+_(''+_('月')), '02'+_('月'), '03'+_('月'), '04'+_('月'), '05'+_('月'), '06'+_('月'), '07'+_('月'), '08'+_('月') , '09'+_('月') , '10'+_('月'), '11'+_('月'), '12'+_('月')],
    dayNamesShort: [_('日'), _('一'), _('二'), _('三'), _('四'), _('五'), _('六')],
    closeOnSelect:true,
});
var calendarDateFormat = myApp.calendar({
	input: '#ecreatetime',
    monthNames: ['01'+_(''+_('月')), '02'+_('月'), '03'+_('月'), '04'+_('月'), '05'+_('月'), '06'+_('月'), '07'+_('月'), '08'+_('月') , '09'+_('月') , '10'+_('月'), '11'+_('月'), '12'+_('月')],
    dayNamesShort: [_('日'), _('一'), _('二'), _('三'), _('四'), _('五'), _('六')],
    closeOnSelect:true,
});
var calendarDateFormat = myApp.calendar({
	input: '#screatetime',
    monthNames: ['01'+_(''+_('月')), '02'+_('月'), '03'+_('月'), '04'+_('月'), '05'+_('月'), '06'+_('月'), '07'+_('月'), '08'+_('月') , '09'+_('月') , '10'+_('月'), '11'+_('月'), '12'+_('月')],
    dayNamesShort: [_('日'), _('一'), _('二'), _('三'), _('四'), _('五'), _('六')],
    closeOnSelect:true,
});
var calendarDateFormat = myApp.calendar({
	input: '#_arrivalTime',
    monthNames: ['01'+_(''+_('月')), '02'+_('月'), '03'+_('月'), '04'+_('月'), '05'+_('月'), '06'+_('月'), '07'+_('月'), '08'+_('月') , '09'+_('月') , '10'+_('月'), '11'+_('月'), '12'+_('月')],
    dayNamesShort: [_('日'), _('一'), _('二'), _('三'), _('四'), _('五'), _('六')],
    closeOnSelect:true,
});
(function(){
	var apply = {
		init: function(){
			this.LoadData();
			this.bindEvents();
		},
		bindEvents:function(){
			var self = this;
			 //跳转页面
             $("#navMenu a").on("click",function(){
            	var link_url=$(this).attr("data-href");
            	if(APP){
            		var appJson={};
           			appJson.title=$(this).attr("data-title");
           			appJson.url=app_url+link_url;	
           			YiYi_APP.showNewPage(JSON.stringify(appJson));
            	}else{
            		location.href = link_url;
            	}
            });
			//点击行展开详情
			$("#stock_body").on("click", "tr td", function () {
			    var td_input = $(this).index();
			    if (td_input == 0 || td_input==7 || td_input==8) {
			        //勾选框不展开详情
			    } else {
			        $(this).parent("tr").next(".stock_detail").slideToggle(0);
			    }
			});
			$("#detail tbody").on("click", "tr td", function () {
			    $(this).parent("tr").next(".stock_detail").slideToggle(0);
			});
			
			//点击筛选按钮
			$("#show_term_btn").on("click", function () {
				myApp.popup(".user_filter_box");
			});
			//确定筛选
			$("#confirm_btn").on("click",function(){
				self.LoadData();//获取数据列表
				myApp.closeModal(".user_filter_box");
			});
			//状态筛选
			$("#_sysStatus>ul").on("click", "li", function () {
				$(this).addClass("add_blue").siblings().removeClass("add_blue");
				self.LoadData();//获取数据列表
			});			
			//列表的勾选框
			$("#stock_body").on("click",".check_list_box",function(){
				$(this).children("span").toggleClass("selected");
			});
			//重置
			$("input[type=reset]").on("click",function(){
				$("#_role li").removeClass("add_blue").css("background","#a1a1a1");
			});
			//排序方式
            $("#product_table_fixed th").on("click", function () {
				sortFun($(this));
            });
			
			//修改输入验证 12-8 class=_mod
            var validate = $("._mod").validate({
                debug: true, //调试模式取消submit的默认提交功能   
                focusInvalid: false, //当为false时，验证无效时，没有焦点响应  
                onkeyup: false,
                submitHandler: function (form) {   //表单提交句柄,为一回调函数，带一个参数：form   
                    self.EditFlow();//修改流水
                },
                rules: {
                    Amount:"required", 
                    Remarks: "required", 
                    Comments: "required",//审核备注
                    Account:"required", 
                    ArrivalTime: "required", 
                    Type: "required",
                },
                messages: {
                    Amount:"",
                    Remarks: "",
                    Comments: "required",//审核备注
                    Account:_("必选"),
                    ArrivalTime:"",
                    Type:"required",
                }
            });

			
		},
		//获取参数
        getParamer:function(){
            var requestApplys = {};

            if(RoleID == 1 || RoleID == 2){                
                requestApplys.UserRealName= $.trim($("#_saleRealName").val());
            }else{
                requestApplys.ApplyID = UserID;
            }

            //名字cookie 充值页面传来的_rnick  10-28
            if($.cookie("_rnick")){
                $("#_customerRealName").val($.cookie("_rnick"));//真名
                $.cookie("_rnick","",-1);
            }

            requestApplys.CustomerNickName = $.trim($("#_customerCs").val());//昵称
            requestApplys.CustomerRealName = $.trim($("#_customerRealName").val());

            requestApplys.Amount = $("#_amt").val();//12-21

            if( $.cookie("_charge_statu_c")){
                requestApplys.Status=0;//待审核
                $("._charge_statu_c").addClass("current").siblings().removeClass("current");
                $.cookie("_charge_statu_c","",-1);
            }
            requestApplys.Status = $("#_sysStatus>ul li.add_blue").attr("data-value");//下拉框

            requestApplys.Account = $("#sel_accountID").val();
            requestApplys.Type = $("#sel_type").val();
            requestApplys.Abstract = $("#sel_abstract").val();//摘要
            requestApplys.Currency = $("#sel_currency").val();//币种
            requestApplys.SCreateTime = $("#screatetime").val();
            requestApplys.ECreateTime = $("#ecreatetime").val();
            requestApplys.SUpdateTime = $("#supdatetime").val();
            requestApplys.EUpdateTime = $("#eupdatetime").val();
            requestApplys.PageSize = 500; //id=_pageSizes
            requestApplys.PageIndex = 1;//.page_num是class
            return requestApplys;
        },
		 //加载
        LoadData:function(p) {
        	var self = this;
        	myApp.showIndicator();//显示加载中
            if(p){
                var requestCharges=p;
            }else{
                if(b_lang==1){
                    var requestCharges =  self.getParamer();
                    requestCharges.Status  = lang;
                }else{
                    var requestCharges = self.getParamer(requestCharges);
                }
            }
            $.ajax({
                url: "/Team/GetFlows",//提交地址
                type: "POST",//提交方式
                data: JSON.stringify(requestCharges),
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                    var _result = eval('('+result+')');
		
		            if (_result.msgcode == false) {
		            	
		                var tr = "";//单行
		                var tds = "<td colspan='9' style='text-align:center;color:red'>" + _(_result.msginfo) + "</td>";// 多列合成一列并居中
		                tr = "<tr>" + tds + "</tr>";//将多列加到一行
		                $("#stock_body").html(tr);//加入到id为customer的table的tbody中
		                myApp.hideIndicator();  //数据加载完成后去除全屏遮罩层
		            } else {
		               _result = _result.msginfo.Data;//object
		               SortJson = _result;
		               BindingData(_result, $("#stock_body"));//绑定
		            }   
                    
                }
                     
   			});
   			myApp.hideIndicator();//隐藏加载中
        },
                //修改充值
        EditFlow:function() {
			var self = this;

            var requestFlow = {};

            requestFlow.ID = $("#_iD").val();
            //requestFlow.OrderIDs = $("#_orderIDs").val();
            requestFlow.Remarks = $("#_remarks").val();
            //requestFlow.Receivable = $("#_receivable").val();
//            requestFlow.Comments = $("#_comments").val();//审核备注
            //requestFlow.Customer = $("#_customer").val();
            requestFlow.Amount = $("#_amount").val();
            //requestFlow.Type = $("#_type").val();//1收入 2支出
            requestFlow.Type = $("#_type option:checked").val();//下拉框
            requestFlow.Currency = $("#_currency option:checked").val();//下拉框
            requestFlow.Abstract = $("#_abstract option:checked").val();

            requestFlow.InCome = $("#_inCome").val();
            requestFlow.ArrivalTime = $("#_arrivalTime").val();

            //requestFlow.Purpose = $("#_purpose option:checked").val();
            //requestFlow.Account = $("#_account option:checked").val();
            requestFlow.Account = $("#mod_accountID option:checked").val();//12-23
            
            //requestFlow.Status = $("#_status option:checked").val();//下拉框
            requestFlow.Status =$('input:radio[name="Status"]:checked').val(); //单选框

            $.ajax({
                url: "/Team/EditFlow",//ModifyFlow审核  EditFlow 修改
                type: "POST",//提交方式
                data: JSON.stringify(requestFlow),
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                    var _result = eval('(' + result + ')');//eval()解析单个json对象

                    $(".modify_pop_box input[type=reset]").trigger("click");//清空form数据 8-30 关键 一定要放最前面

                    $("#_editflow").html(_result.msginfo);

                    if(_result.msgcode == true){
                        $("._editflow_tip").show().fadeOut(4000);//闪出提示 500为0.5s
                        $("._editflow_tip").addClass("succ");//成功笑脸
                        $(".modify_pop_box").hide();
                        self.LoadData();//加载
                    }else{
                        $("._editflow_tip").show().fadeOut(4000);//闪出提示 500为0.5s
                        $("._editflow_tip").addClass("fail");//失败哭脸
                    }
                }
            });
        },

	}
	apply.init();
})();

//账户列表 12-21
function AccountLoad() {
    var requestAccount = {};
    requestAccount.Status = 1;//启用1
    requestAccount.Type ='2,3';
    $.ajax({
        url: "/Team/GetBankList",//提交地址
        type: "POST",//提交方式
        async: false, //异步 9-27
        data: JSON.stringify(requestAccount),
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            var _result = eval('(' + result + ')');//eval()解析单个json对象
            if (_result.msgcode == false) {
                var options = "";
                options += '<option value="">' + _(_result.msginfo) + '</option>';
                $("#sel_accountID").html("");//账户下拉
                $("#sel_accountID").html(options);
            } else {
                var options = "";
                options += '<option value="">'+_("账户")+'</option>';
                for (var i = 0; i < _result.length; i++) {
                    options += '<option value="' + _result[i].BankID + '"  >' + _(_result[i].BankName) + '</option>';
                }
                $("#sel_accountID").html("");//账户下拉
                $("#sel_accountID").html(options);
            }
        }
    });
}

//账户列表 12-23
function XgAccountLoad() {
    var requestAccount = {};
    requestAccount.Status = 1;//启用1
    requestAccount.Type ='2,3';
    $.ajax({
        url: "/Team/GetBankList",//提交地址
        type: "POST",//提交方式
        async: false, //异步 9-27
        data: JSON.stringify(requestAccount),
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            var _result = eval('(' + result + ')');//eval()解析单个json对象
            if (_result.msgcode == false) {
                var options = "";
                options += '<option value="">' + _(_result.msginfo) + '</option>';
                $("#mod_accountID").html("");//账户下拉
                $("#mod_accountID").html(options);
            } else {
                var options = "";
                options += '<option value="">'+_("账户")+'</option>';
                for (var i = 0; i < _result.length; i++) {
                    options += '<option value="' + _result[i].BankID + '"  >' + _(_result[i].BankName) + '</option>';
                }
                $("#mod_accountID").html("");//账户下拉
                $("#mod_accountID").html(options);
            }
        }
    });
}
//流水统计
function FlowNumber(){
    var requestFlow = {};
    if(RoleID == 1 || RoleID == 2){ //管理员1 财务2
        requestFlow.UserRealName= $.trim($("#_saleRealName").val());
    }else{
        requestFlow.ApplyID = UserID;
    }
    $.ajax({
        url: "/Team/FlowNumber",//提交地址
        type: "POST",//提交方式
        data: JSON.stringify(requestFlow),
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            var _result = eval('(' + result + ')');//eval()解析单个json对象
            var totalcharge = 0;
            if(_result.msgcode== true){
                _result = _result.msginfo;
                for (var i = 0; i < _result.length; i++) {
                    if (_result[i].Status == 0) {
                        $("#_charge0").html(_result[i].Number);//待审0
                        totalcharge +=_result[i].Number;
                    }
                    if (_result[i].Status == 1) {
                        $("#_charge1").html(_result[i].Number);//已审1
                        totalcharge +=_result[i].Number;
                    }
                    if (_result[i].Status == -1) {
                        $("#_charge").html(_result[i].Number);//已作废-1
                        totalcharge +=_result[i].Number;
                    }
                    $("#total_charge1").html(totalcharge);
                }
            }else{
                $("#_charge0").html(0);
                $("#_charge1").html(0);
                $("#_charge").html(0);
                $("#total_charge1").html(0);
            }
        }
    });
}
//客户昵称 
function CustomersLoad() {
    var requestCustomer={};
    //业务员3 采购员4 物流员 5
    if(RoleID == 3 || RoleID == 4 || RoleID == 5)
    {
        requestCustomer.SalesUserID = UserID;
    }
    requestCustomer.SysStatus = 1;//正常的客户 9-29
    $.ajax({
        url: "/Team/GetCustomerList",//提交地址
        type: "POST",//提交方式
        async: false, //异步 9-27
        data: JSON.stringify(requestCustomer),
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            var _result = eval('(' + result + ')');//eval()解析单个json对象
            if(_result.msgcode == false){
                var options = "";
                options += '<option value="">' + _(_result.msginfo) + '</option>';
                $("#_customerCodes").html("");//客户昵称下拉
                $("#_customerCodes").html(options); 
            }else{
                var options = "";
                options += '<option value="">'+_("客户昵称")+'</option>';
                for (var i = 0; i < _result.length; i++) {
                    //options += '<option value="' + _result[i].NickName + '"  >' + _result[i].NickName + '</option>';
                    options += '<option value="' +  $.trim(_result[i].NickName )+ '"  >' +$.trim( _result[i].NickName) + '</option>';//解决因为空格导致供应商无法搜索 10-27                      
                }
                $("#_customerCodes").html("");//客户昵称搜索下拉
                $("#_customerCodes").html(options);
            }
        }
    });
}


//订单详情弹出框
function detail_box(me){
    myApp.showIndicator();
    myApp.popup(".detail_pop_box");
    $.ajax({
        url: "/Team/GetOrderIDsDetail",//提交地址
        type: "POST",//提交方式
        data: "{'OrderIDs':'" + me.getAttribute("value") + "'}",
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            BindingDetail(result, $("#detail tbody"));//绑定订单详情 12-8
            myApp.hideIndicator();
        }
    });
}

//审核充值弹出框
function modify_box(me) {
    XgAccountLoad();//12-23
    myApp.popup(".modify_pop_box");
    $.ajax({
        url: "/Team/GetFlow",//提交地址
        type: "POST",//提交方式
        data: "{'ID':'" + me.getAttribute("value") + "'}",
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            var _result = eval('(' + result + ')');//eval()解析单个json对象

            $("#_iD").val(_result.ID);
            //$("#_orderIDs").val(_result.OrderIDs);//订单IDs
             $("#_remarks").val(_result.Remarks);
             //$("#_comments").val(_result.Comments);
             //$("#_customer").val(_result.Customer);
             $("#_arrivalTime").val(DateTimeFormat(_result.ArrivalTime));
             $("#_amount").val(_result.Amount);
             //$("#_type").val(_result.Type); //1收入+ 2支出-
             $("#_type [value='" + _result.Type + "']").prop("selected", true);//下拉框
             $("#_abstract [value='" + _result.Abstract + "']").prop("selected", true);//下拉框
             $("#_currency [value='" + _result.Currency + "']").prop("selected", true);//下拉框
             $("#_receivable").val(_result.Receivable);//应收
             $("#_bal").val(_result.Receivable - _result.Amount);//差额 = 应收 - 实收 12-6
             //$("#_purpose [value='" + _result.Purpose + "']").prop("selected", true);//下拉框
             //$("#_account [value='" + _result.Account + "']").prop("selected", true); 
             $("#mod_accountID [value='" + _result.Account + "']").prop("selected", true);//12-23

             //$("#_status [value='" + _result.Status + "']").prop("selected", true);                    
             //$("input[name='Status'][value='" + _result.Status + "']").attr("checked",true); //给Radio赋值

        }
    });
}      
        
//计算差额
function Compute(){
    var _re =$("#_receivable").val();//应收 
    var _am =$("#_amount").val();//交易金额
    
    if(_re != ""){
        if(_re - _am > 0){

            $("#_bal").val(_re - _am); //差额 = 应收 - 实收
        }else{
            $("#_bal").val(0); //差额 = 0
        }
    }
}
//绑定订单详情 12-8
function BindingDetail(Datas, tableTbody){
    var _result = eval('(' + Datas + ')');//eval()解析单个json对象
    if(_result.msgcode == false){
        var tr = "";//单行
        var tds = "<td colspan='15' style='text-align:center;color:red'>" + _(_result.msginfo) + "</td>";// 多列合成一列并居中
        tr = "<tr>" + tds + "</tr>";//将多列加到一行
        tableTbody.html(tr);//加入到id为detail的table的tbody中
    }else{
        var _totalPrice = 0;

        var trs = "";//多行数据
        
        for (var i = 0; i < _result.length; i++) {
			
            var tds = "";//多列
            var tr = "";//单行
            var tr_div = "";
			var  data=_result[i];
            tds += "<td>" + (i + 1) + "</td>";
            tds += "<td>" + GetText("stocks",data.IsFancy,data.Shape,"Shape") + "</td>";
            tds += "<td>" + data.Weight + "</td>";
            tds += "<td>" + CertTypeFormat(data) + "</td>";//data.CertType
            tds += "<td style='font-weight:bold;'>" + formatRMBPrice(data.ConfirmPrice) + "</td>";
            _totalPrice+=data.ConfirmPrice;
            tds += "<td style='font-weight:bold;'>" + formatUSDPrice(data.PriceUSD) + "</td>";
            tds += "<td>" + DateTimeFormat(data.CreateTime) + "</td>";
            tds += "<td style='font-weight:bold;'>" + PaymentStatusFormat(data.PaymentStatus) + "</td>";//支付状态
            tds += "<td>" + data.SalesUserName + "</td>";

            tr += "<tr class='data_tr'>" + tds + "</tr>";//将多列加到一行
            tr_div="<tr class='stock_detail'><td  colspan='9'>"+
            "<div class='detail_left' style='width:50%;'>"+
                "<i><b>"+_("颜色")+"：</b>"+data.Color+"</i>"+   //颜色 ColorFormat(data)
                "<i><b>"+_("净度")+"：</b>" + data.Clarity + "</i>"+
                "<i><b>"+_("切工")+"：</b>" +  data.Cut + "</i>"+
                "<i><b>"+_("抛光")+"：</b>" +  data.Polish + "</i>"+
            "</div>" +
            "<div class='detail_middle' style='width:50%;'>"+  
            	"<i><b>"+_("对称")+"：</b>" +  data.Symmetry + "</i>"+
                "<i><b>"+_("荧光")+"：</b>" +   data.Fluorescence + "</i>"+
            	"<i><b>"+_("证书号")+"：</b>" + CertNoFormat(data.CertNo) + "</i>" +
            	"<i><b>"+_("退点")+"：</b>" + ConfirmdiscountFormatApply(data.Confirmdiscount) + "</i>"+
            "</div></td></tr>";
            trs += tr+tr_div;//将单行加到多行             
        }
        tableTbody.html(trs);//加入到id为detail的table的tbody中
    }

}
        
$(function(){
    setTimeout(function () { 
        AccountLoad();//账户下拉 12-21
    },2000);//2s
	setTimeout(function () { 
    	CustomersLoad();//客户下拉 10-28
	},1500);//1.5s 
    setTimeout(function () { 
        FlowNumber();//流水统计
    },500);//0.5s 
});
//绑定数据
function BindingData(_result, tableTbody) {
	 var trs = "";//多行数据
        for (var i = 0; i < _result.length; i++) {
			
            var tds = "";//多列
            var tr = "";//单行
            var tr_div = "";
			var data=_result[i];
            tds += "<td class='check_rel' value='"+i+"'>"+
            "<div class='check_list_box'><span class='checkbox' name='checkbox' lang='" + data.UserID + "'></span></div>";
            tds += "<td>" + NullFormat(data.BankName) + "</td>";
            if(data.Type == 1){
                //收入1
                tds += "<td>-</td>";                    
                tds += "<td>" + data.Amount + "</td>";
            }else{
                //支出2
                tds += "<td>" + data.Amount + "</td>";                    
                tds += "<td>-</td>";
            }
            tds += "<td style='font-weight:bold;'>" + TypeFormat(data.Type) + "</td>";
            tds += "<td>" + NullFormat(data.NickName) + "</td>";
            tds += "<td>" + AccountStatusFormat(data.Status) + "</td>";
            tds += "<td><span title='订单详情' onclick='detail_box(this)' value='" + data.OrderIDs + "'>"+ OrderIDsFormat(data.OrderIDs) +"</span></td>"
            //状态Status 0待审核 1已审核 -1 已作废
            if(data.Status == 0){
                tds += "<td class='check_toolbtn'>"+
                "<span class='modify' title='修改流水' onclick='modify_box(this)' value='" + data.ID + "'>"+_("修改")+"</span></td>";
            }else if(data.Status == 1){
                //tds += "<td class='check_toolbtn'><span class='modify' title='修改流水' onclick='modify1_box(this)' value='" + data.ID + "'>修改</span></td>";
                tds += "<td class='check_toolbtn'></td>";           
            }
            else{
                tds += "<td class='check_toolbtn'></td>";
            }          
            
            tr += "<tr class='data_tr'>" + tds + "</tr>";//将多列加到一行
            tr_div="<tr class='stock_detail'><td  colspan='9'>"+
            "<div class='detail_left' style='width:50%;'>"+
                "<i><b>"+_("到账时间")+"：</b>"+DateFormat(data.ArrivalTime)+"</i>"+
                "<i><b>"+_("应收")+"：</b>" + FormatMoney(data.Receivable) + "</i>"+
                "<i><b class='custrom'>"+_("摘要")+"：</b><span>" + AbstractFormat(data.Abstract) + "</span></i>"+
                "<i><b>"+_("客户余额")+"：</b>" +  NullFormat(data.CustomerBalance) + "</i>"+
                 "<i style='height:auto'><b>"+_("申请人")+"：</b>" + data.Applicants + "</i>"+
                "<i onclick='showTotalWord(this)'><b class='custrom'>"+_("申请备注")+"：</b><span>" + NullFormat(data.Remarks)  + "</span></i>"+
            "</div>" +
            "<div class='detail_middle' style='width:50%;'>"+       
            	"<i><b>"+_("申请时间")+"：</b>" + DateTimeFormat(data.CreateTime) + "</i>" +
            	"<i><b>"+_("审核人")+"：</b>" + NullFormat(data.Reviewer) + "</i>"+
            	"<i onclick='showTotalWord(this)'><b class='custrom'>"+_("审核备注")+"：</b><span>" + NullFormat(data.Comments) + "</span></i>" +
            	"<i><b>"+_("审核时间")+"：</b>" +  DateTimeFormat(data.UpdateTime) + "</i>"+
            	"<i><b>"+_("币种")+"：</b>"+ CurrencyFormat(data.Currency) +"</i>"+
                
            "</div></td></tr>";
            trs += tr+tr_div;//将单行加到多行
        }
    $("#stock_body").html(trs);//加入到id为customer的table的tbody中
}